import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Topic from '../views/Topic.vue'
import Category from '../views/Category.vue'
import Cart from '../views/Cart.vue'
import My from '../views/My.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
  {
    path: '/topic',
    name: 'Topic',
    component: Topic,
  },
  {
    path: '/topicDetail/:id',
    name: 'TopicDetail',
    component: () => import('../views/TopicDetail'),
    props: true,
  },

  {
    path: '/category',
    name: 'Category',
    component: Category,
  },
  {
    path: '/categoryList/:id',
    name: 'CategoryList',
    component: () => import('../views/CategoryList'),
    props: true,
  },
  {
    path: '/product/:id',
    name: 'Product',
    component: () => import('../views/Product'),
    props: true,
  },
  {
    path: '/cart',
    name: 'Cart',
    component: Cart,
  },
  {
    path: '/my',
    name: 'My',
    component: My,
  },
]

const router = new VueRouter({
  routes,
})

export default router
